import { createRouter, createWebHistory, createWebHashHistory, RouteRecordRaw } from 'vue-router'
import {
  Histogram, Grid, User
} from '@element-plus/icons-vue'

const routes: Array<RouteRecordRaw> = [

  {
    path: '/login',
    name: 'IndexView',
    component: () => import('../views/login/IndexView.vue')
  },
  {
    path: '/home',
    name: 'Home',
    component: () => import('../views/home/HomeView.vue'),
    meta: { authRequired: true },
    children: [
      {
        path: '/echarts',
        name: 'Echarts',
        component: () => import('../views/home/childrens/EchartsView.vue'),
        meta: {
          title: "数据展示",
          icon: Histogram
        }
      },
      {
        path: '/pay',
        name: 'Pay',
        component: () => import('../views/home/childrens//PayList.vue'),
        meta: {
          title: "缴费管理",
          icon: Grid
        }
      },
      {
        path: '/user',
        name: 'User',
        component: () => import('../views/home/childrens/UserOne.vue'),
        meta: {
          title: "住户信息",
          icon: User
        },
        children: [
          {
            path: '/userlist',
            name: 'UserList',
            component: () => import('../views/home/childrens/UserList.vue'),
            meta: {
              classifyTitle: "住户信息",
              title: "住户信息列表"
            }
          },
          {
            path: '/userupdata',
            name: 'UserUpdata',
            component: () => import('../views/home/childrens/UserUpdata.vue'),
            meta: {
              classifyTitle: "住户信息",
              title: "住户信息修改"
            }
          }
        ]
      }
    ]
  },
  //设置首页面
  {
    path: "/",
    redirect: "/login"
  }
]

const router = createRouter({
  history: createWebHashHistory(process.env.BASE_URL),
  routes
})

export default router
